package com.mark.spring.annotation.register.factory;

import org.springframework.beans.factory.FactoryBean;

/**
 * @Description: 自定义工厂Bean
 * @Author: Mark
 * @CreateDate: 2019/9/21 10:18
 * @Version: 3.00.001
 * @Copyright : 豆浆油条个人非正式工作室
 */
public class StringFactoryBean implements FactoryBean<String> {

    @Override
    public String getObject() throws Exception {
        return new String("Test");
    }

    @Override
    public Class<?> getObjectType() {
        return String.class;
    }

    /**
     * 是否单例
     * true：声明为单例的Bean，在容器中只会保存一份
     * false：多实例，每次获取都会构建一个新的Bean
     * @return boolean
     */
    @Override
    public boolean isSingleton() {
        return false;
    }
}
